from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver=webdriver.Chrome()
driver.get('https://www.baidu.com/')
print(driver.title)

# result1=WebDriverWait(driver,5,poll_frequency=1).until(lambda x :  True if x.title =='百度一下，你就知道' else False,message='超时')
# print(result1)
result1=WebDriverWait(driver,5).until(EC.title_is('百度一下，你就知道'), message='标题一致')
print(result1)

result2=WebDriverWait(driver,5,poll_frequency=1).until_not(lambda x :  True if x.title =='百度一下1，你就知道' else False,message='超时')
print(result2)

driver.quit()